{% extends 'base_with_listing.html' %}


{% block title %}
  {% if displays_only_active %}
    Active bookrequests
  {% else %}
    All bookrequests
  {% endif %}
{% endblock %}
  
{% block header %}
  {% if displays_only_active %}
    Active bookrequests
  {% else %}
    All bookrequests
  {% endif %}
{% endblock %}



{% block order %} [[1,1]] {% endblock %}
{% block itemsWrapper %}bookrequests_list itemsWrapper{% endblock %}

    {% block before_table %}
    <div class="inner_menu">
      <ul>
        {% if displays_only_active %}
          <li><a href="{% url bookrequest_all %}">Show also archival requests</a></li>
        {% endif %}
        {% if displays_all %}
          <li><a href="{% url bookrequest_active %}">Show only active requests</a></li>
        {% endif %}
        {%if perms.baseapp.add_bookrequest%}<li><a href="{% url bookrequest_add %}">Add another bookrequest</a> </li>{% endif %}
      </ul>
    </div>
    {% endblock %}

    {% block header_row %}
      {% if perms.baseapp.list_bookrequests %}
          {% if perms.baseapp.view_bookrequest %}
            <th></th>
          {% endif %}
          <th>When</th>
          <th>Who</th>
          <th>Book</th>
          <th>Info</th>
          {% if displays_all %}
            <th>Is done (archival)</th>
          {% endif %}
      {% endif %}
    {% endblock %}

    {% block item_row %}
      {% if perms.baseapp.list_bookrequests %}
          {% if perms.baseapp.view_bookrequest %}
            <td class="options">
              <a href="{% url bookrequest_one row.id %}">Show details</a>
            </td>
          {% endif %}

          <td class="when"> 
            {{ row.when|date:"Y-m-d H:i"}}
          </td>          
          <td class="who">
            {{ row.who.get_full_name }}
          </td>
          
          <td class="book">
            {{ row.book|default:"-" }}
          </td>
          
          <td class="info">
            {{ row.info }}
          </td>

          {% if displays_all %}
            <td class="done_status">
              {{ row.done|yesno:_("Yes,No") }}
            </td>
          {% endif %}
      {% endif %}
    {% endblock %}

    {% block after_table %}
      {% if rows|length < 1 %}
        <p><b>Nothing found</b></p>
      {% endif %}
    {% endblock %}